package mathutil;

import java.util.Random;
import org.testng.annotations.Test;

/**
 * @author
 */
public class Random1 {

    final int TURN = 5;

    /**
     * 生成一定范围内的随机数
     */
    @Test(invocationCount = 4)
    private void t1() {
        Random r = new Random();
        for (int i = 0; i < TURN; i++) {
            // 10以内的正整数，不包括10
            System.out.print(r.nextInt(10) + " ");
        }
        System.out.println("---------------");
    }

    /**
     * 生成随机浮点数
     */
    @Test
    private void t2() {
        Random r = new Random();
        for (int i = 0; i < TURN; i++) {
            // 10以内的正整数，不包括10
            System.out.println(r.nextDouble());
        }
    }



}
